Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

INSANE bugs #1463

Merged
merged 2 commits into from
Sep 1, 2019
Merged

INSANE bugs #1463

merged 2 commits into from
Sep 1, 2019

Conversation

jglick
Copy link
Contributor

@jglick jglick commented Aug 27, 2019

Things that I bumped into while investigating jenkinsci/bom#77. I actually have a laundry list of INSANE issues to fix, but one thing at a time.

@jglick
Copy link
Contributor Author

jglick commented Aug 27, 2019

It is still failing to find a root reference which, for example, YourKit displays:

… →
hudson.model.Hudson.queue →
hudson.model.Queue.leftItems →
com.google.common.cache.LocalCache$LocalManualCache.localCache →
com.google.common.cache.LocalCache.segments →
com.google.common.cache.LocalCache$Segment[].<index> →
com.google.common.cache.LocalCache$Segment.table →
java.util.concurrent.atomic.AtomicReferenceArray.array →
java.lang.Object[].<index> →
com.google.common.cache.LocalCache$StrongWriteEntry.valueReference →
com.google.common.cache.LocalCache$StrongValueReference.referent →
hudson.model.Queue$LeftItem.task →
org.jenkinsci.plugins.workflow.support.steps.ExecutorStepExecution$PlaceholderTask.body →
org.jenkinsci.plugins.workflow.cps.CpsBodyExecution.outcome →
com.cloudbees.groovy.cps.Outcome.normal →
java.lang.Class(p.C).classLoader →
<target>

I checked that implementing this TODO did not help, because MemoryAssert already works out:

diff --git a/harness/o.n.insane/src/org/netbeans/insane/impl/InsaneEngine.java b/harness/o.n.insane/src/org/netbeans/insane/impl/InsaneEngine.java
index e1a1b5b1ac..f47fbf1586 100644
--- a/harness/o.n.insane/src/org/netbeans/insane/impl/InsaneEngine.java
+++ b/harness/o.n.insane/src/org/netbeans/insane/impl/InsaneEngine.java
@@ -190,7 +190,12 @@ try {
         //if (cls.getName().startsWith("org.netbeans.insane.scanner")) return; // skip refs from myself
 
         ClassLoader cl = cls.getClassLoader();
-        if ( cl != null) recognize(cl);
+        if (cl != null) {
+            if (filter.accept(cl, cls, null)) {
+                recognize(cl);
+                if (objects.isKnown(cl)) visitor.visitObjectReference(objects, cls, cl, /* cannot get a Field for Class.classLoader */ null);
+            }
+        }
 
         // process only fields declared by this class,
         // fields of all superclasses were already processed in separate run.
diff --git a/harness/o.n.insane/src/org/netbeans/insane/scanner/SimpleXmlVisitor.java b/harness/o.n.insane/src/org/netbeans/insane/scanner/SimpleXmlVisitor.java
index 2f48f271d4..cea5a72f45 100644
--- a/harness/o.n.insane/src/org/netbeans/insane/scanner/SimpleXmlVisitor.java
+++ b/harness/o.n.insane/src/org/netbeans/insane/scanner/SimpleXmlVisitor.java
@@ -120,7 +120,7 @@ public final class SimpleXmlVisitor implements Visitor {
     }
     
     private static String getFldName(Field fld) {
-        return fld.getDeclaringClass().getName() + "." + fld.getName();
+        return fld == null ? "?" : fld.getDeclaringClass().getName() + "." + fld.getName();
     }
 
 

So not sure why INSANE fails in this case.

@lkishalmi
Copy link
Contributor

The changes are sane, I'm going to merge them.

@lkishalmi lkishalmi merged commit 18203ce into apache:master Sep 1, 2019
@junichi11 junichi11 added this to the 11.2 milestone Sep 2, 2019
@jglick jglick deleted the insane branch September 3, 2019 18:26
@jglick
Copy link
Contributor Author

jglick commented Sep 3, 2019

@lkishalmi is there a reason you did not merge the patch to Path.java? Never mind, was committed as 1d6c743 rebase-style. (Personally I prefer to use plain old merge, but maybe there is some project policy about this.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants